package org.aeon.gamechatnest.pojo;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Null;
import lombok.Data;
import org.aeon.gamechatnest.validated.Add;

import java.io.Serial;
import java.io.Serializable;
import java.util.Date;

/**
 * 好友请求实体
 *
 * @TableName friend_request
 */
@Data
@Schema(description = "好友请求实体", name = "FriendRequest")
@TableName("friend_request")
public class FriendRequest implements Serializable {
    /**
     * 好友请求id
     */
    @Schema(description = "请求编号", name = "requestId")
    @Null(groups = Add.class, message = "新增时id应该为空")
    @TableId
    private Long requestId;

    /**
     * 发起用户
     */
    @Schema(description = "发起用户", name = "fromUser")
    @Null(groups = Add.class, message = "新增时fromUser不能为空")
    private Long fromUser;

    /**
     * 接受用户
     */
    @Schema(description = "接受用户", name = "toUser")
    @NotNull(groups = Add.class, message = "新增时toUser不能为空")
    @Min(groups = Add.class, value = 0, message = "目标用户id非法")
    private Long toUser;

    /**
     * 创建时间
     */
    @Schema(description = "创建时间", name = "createTime")
    @Null(groups = Add.class, message = "新增或更新时createTime不能为空")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    /**
     * 验证消息
     */
    @Schema(description = "验证消息", name = "verifyContent")
    @NotBlank(groups = Add.class, message = "新增时verifyContent不能为空")
    private String verifyContent;

    /**
     * 验证状态（0：未通过，1：接受，2：拒绝）
     */
    @Schema(description = "验证状态", name = "verifyStatus")
    @Null(groups = Add.class, message = "新增,更新时verifyStatus不能为空")
    private Integer verifyStatus;

    @Serial
    private static final long serialVersionUID = 1L;
}
